Update User
The Patch User API allows you to update details of an existing user. The updates depend on the type parameter in the JSON request body, which must be either userStatus
or callingEnabled
.
API Endpoint
api/v1/business/user?apikey=<API KEY>&email=<EMAIL ID>
- Method: PATCH
- Content-Type: application/x-www-form-urlencoded (form-data)
- Required Parameters (in query string):
apikey
: Your API keyemail
: Email ID of the user
Request Syntax
PATCH api/v1/business/user?apikey=<API KEY>&email=<EMAIL ID>
Request Body (JSON)
The request body structure depends on the type field. There are two supported types:
1. Update User Status (type = "userStatus")
Use this to update the current status of the user.
Required Fields:
{
"userId": "a599947d-bc5c-4b45-b93c-5a318e2e2243",
"type": "userStatus",
"userStatus": "InCall"
}
- Accepted
userStatus
values:Available
Busy
InCall
Away
Disabled
2. Enable/Disable Calling (type = "callingEnabled")
Use this to enable or disable calling for a user and specify the phone number.
Required Fields:
{
"userId": "a599947d-bc5c-4b45-b93c-5a318e2e2243",
"type": "callingEnabled",
"callingEnabled": true,
"phoneNumber": "9901425378"
}
- callingEnabled: true or false
- phoneNumber: A valid phone number associated with the user
Properties
Property | Type | Required | Description |
---|---|---|---|
userId | string | Yes | Unique identifier of the user to be updated |
type | string | Yes | Determines the kind of update (userStatus or callingEnabled ) |
userStatus | string | Conditionally (if type is userStatus ) | Status to be assigned |
callingEnabled | boolean | Conditionally (if type is callingEnabled ) | Flag to enable or disable calling |
phoneNumber | string | Conditionally (if type is callingEnabled ) | Phone number for calling operations |
Example
Sample Request
curl --location --request PATCH 'https://alb-backend.msgkart.com/api/v1/business/user?apikey=<API KEY>&email=<EMAIL ID>' \
--header 'Content-Type: application/json' \
--data '{
"userId": "a534347d-bc5c-442a-b93c-5a3234e2e43",
"type": "callingEnabled",
"userStatus": "InCall",
"callingEnabled": true,
"phoneNumber": "9901425378"
}'
Response
- HTTP Status Code: 200 OK (successful), 4xx/5xx (error)
- Response Body: JSON object containing user status details.
Error Handling
- Invalid credentials: 401 Unauthorized
- Missing/invalid parameters: 400 Bad Request
- Internal server error: 500 Internal Server Error